package com.changgou.goods.dao;

import com.changgou.goods.pojo.Sku;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface SkuMapper extends Mapper<Sku> {

    @Insert("<script> INSERT INTO tb_sku "
            + "(sn,name,price,num,alert_num,image,images,weight,create_time,"
            +"update_time,spu_id,category_id,category_name,brand_name,spec,sale_num,"
            +"comment_num,status,id)"
            + "VALUES "
            + "<foreach collection = 'list' item='sku' separator=',' > "
            + " (#{sku.sn},#{sku.name},#{sku.price},#{sku.num},#{sku.alertNum},#{sku.image},#{sku.images},#{sku.weight},#{sku.createTime},"
            +"#{sku.updateTime},#{sku.spuId},#{sku.categoryId},#{sku.categoryName},#{sku.brandName},#{sku.spec},#{sku.saleNum},"
            + "#{sku.commentNum},#{sku.status},#{sku.id})"
            + "</foreach>"
            + "</script>"
           )
    boolean  insertBatch(@Param("list") List<Sku> skuList);
}

